home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
dbms_mag
/
9101
/
techtip2.jan
< prev
next >
Wrap
Text File
|
1990-11-16
|
2KB
|
45 lines
Listing 2
PROC MakeKey(tbl,a) ; pass the table name and the number
; of key fields
{Modify} {Restructure} ; begin the restructure procedure
TYPEIN tbl ENTER ; specify table to be restructured
IF SEARCH("*",[Field Type]) = 0 THEN ; the table isn't keyed,
; so key it
Right Right ; move to [Field Type]
i = 1 ; set the fields-keyed counter to 1
WHILE i <=a ; as long as the fields-keyed counter
; is less than or equal to the number
; of fields to be keyed,
; perform this loop
"*" Down ; make the current field a key field
i = i + 1 ; increment the fields-keyed counter
ENDWHILE
Do_It! ; when all necessary field are keyed,
; complete the restructure and
ClearImage ; remove the table from the workspace
ELSE ; the table is already keyed
Menu {Cancel} ; so don't restructure it
ENDIF
RELEASE VARS i
ENDPROC
PROC UnKey(tbl) ; pass name of the table to be unkeyed
{Modify} {Restructure} ; restructure the table
TYPEIN tbl Enter ; specify the table to be unkeyed
Right Right ; move to [Field Type]
IF SEARCH ("*",[Field Type]) <> 0 THEN ; this table is keyed
WHILE SEARCH ("*",[Field Type]) <> ) ; as long as current
; field is keyed
Backspace Down ; unkey field and move to next field
ENDWHILE
Do_It! ; complete the restructure
ClearImage ; clear the restructured table
; from the workspace
ELSE ; the table isn't keyed already
Menu {Cancel} ; cancel the restructure
ENDIF
RELEASE VARS tbl
ENDPROC